//
//  BMUserManager.h
//  BicycleMap
//
//  Created by vedon on 5/15/16.
//  Copyright © 2016 Qianqian. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BMUserInfo.h"
#import <AVOSCloud/AVOSCloud.h>

typedef void (^BMUserInfoCompletedBlock)(AVObject *avObject ,NSError *error);
typedef void (^BMUserUploadFileCompletedBlock)(NSString *fileUrl,NSError *error);
typedef void (^BMFetchFriendListCompletedBlock)(NSArray <BMUserInfo *>* list);

@interface BMUserManager : NSObject

@property (nonatomic,strong,readonly) BMUserInfo *currentUserInfo;

+ (instancetype)shareManager;

- (BOOL)isLogin;

- (BOOL)isUserAlreadyExist:(NSString *)mobile;

- (void)save;

- (void)logout;

- (void)saveWithUserInfo:(BMUserInfo *)userInfo completedBlock:(BMUserInfoCompletedBlock)completedBlock;

- (void)refreshUserInfoWithCompletedBlock:(BMUserInfoCompletedBlock)completedBlock;

- (void)fetchUserInfoWithName:(NSString *)name completedBlock:(BMUserInfoCompletedBlock)completedBlock;

- (void)updateUserInfoWithUserInfo:(BMUserInfo *)userInfo completedBlock:(BMUserInfoCompletedBlock)completedBlock;

- (void)syncUserLocationToServer:(CLLocationCoordinate2D)location;

- (void)uploadUserAvatar:(UIImage *)image completedBlock:(BMUserUploadFileCompletedBlock)completedBlock;

- (void)fetchFriendsListWithCompletedBlock:(BMFetchFriendListCompletedBlock)completedBlock;

@end
